import os
def relpath(p1, p2):
    # 1. remove all trailing slash
    p1 = p1.strip()
    p2 = p2.strip()
    if p1[-1] == '/':
        p1 = p1[:-1]
    if p2[-1] == '/':
        p2 = p2[:-1]

    # 2. check if p2 is part of p1
    p2len = len(p2)
    if p1[0:p2len] == p2:
        # go ahead
        # 3. remove P2 from P1
        return p1[p2len+1:]
    else:
        return ''
